#include <cstdio>

#define INC(x, y) (x = (x+(y))%mods)

using namespace std;

typedef long long ll;
const int maxn=3000, maxk=3000, mods=1000000007;

int main() {
    freopen("justice.in", "r", stdin);
    freopen("justice.out", "w", stdout);

    static ll f[maxn+1][2], suf[maxn+1];
    int m, n, k, x, y, len;
    scanf("%d %d %d %d %d", &m, &n, &k, &x, &y);

    if (x==y) {
        printf("1\n");
        return 0;
    }

    ll ans=0;
    len = (m+n-1)/(k-1);
    f[0][0] = 1;
    for (int i=1; i<=len; i++) {
        suf[0] = 0;
        for (int j=0; j<=n; j++) {
            suf[j] = (j ? suf[j-1] : 0) + f[j][0];
            f[j][0] = (suf[j] - (j>=k ? suf[j-k] : 0) + mods) % mods;
            f[j][1] = (suf[j-1] - (j>=k ? suf[j-k] : 0) + mods) % mods;
            if (j && (i*k-i+1-j) && j%(k-1)==n%(k-1) && i*k-i+1-j<=m) {
                INC(ans, f[j][1]);
            }
        }
    }
    printf("%lld\n", ans);

    fclose(stdin);
    fclose(stdout);
    return 0;
}
